//引入express
const express = require('express');
//创建服务器web
const app = express();
//设置端口号
app.listen(3000);
//引入中间件body-parser
const bodyParser = require('body-parser');
//使用中间件body-parser中间件将所有的post请求的数据解析为对象
app.use(bodyParser.urlencoded({
    extended: false //是否使用第三方模块
}));
/*引入路由模块*/
var index = require("./routes/index.js");
var products = require("./routes/products.js");
var users = require("./routes/users.js");
var cart = require("./routes/cart.js");
app.use(express.static('upload'))
/*使用路由器来管理路由*/
app.use("/index", index);
app.use("/products", products);
app.use("/users", users);
app.use("/cart", cart);
console.log("running3000.....")